UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'GdEAWljY4wwWYoBC9SIzhyvcE/9gbZIJ4uePPP12Idw=' 
WHERE 
  key_id = 'e8db93c301ff3a0b30fd4c3bf4c858cc5df753488a174e5b5760d1274e5ed340' 
  AND (
    token = 'GdEAWljY4wwWYoBC9SIzhyvcE/9gbZIJ4uePPP12Idw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028