UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'PEO80j4CJPuP4B+td9IvOhNdLobNQvWoamXHYvgugDI=' 
WHERE 
  key_id = '6c7c87b0d83121ed413d1b48d80ff1ac1341d18b1ccdc661493e336738a75b29' 
  AND (
    token = 'PEO80j4CJPuP4B+td9IvOhNdLobNQvWoamXHYvgugDI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00055