UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'PDQp1MQqHFglTx60I+oDkIGLaOLmJipz07Sjq82IedA=' 
WHERE 
  key_id = '42e6c006580c9dcf6a10cab7d3ad8f65221feb6e438a81e103f80febde0991a5' 
  AND (
    token = 'PDQp1MQqHFglTx60I+oDkIGLaOLmJipz07Sjq82IedA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026