UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'UTM2Ab0xfGco7+G6vr9OSZvftiEOneCj58/ae29yQ50=' 
WHERE 
  key_id = '158b01c85592a3105adad3d787feac03dfb460603eea469b0913d7f2057fbafe' 
  AND (
    token = 'UTM2Ab0xfGco7+G6vr9OSZvftiEOneCj58/ae29yQ50=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00054