UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'fhuizQXynm1YawHJLI9+GYfu/+8KnGMal+EalemtGRA=' 
WHERE 
  key_id = '39f74a054df918efa132287770b66f1612ccab83d76f622c711a14a2dc4b9df8' 
  AND (
    token = 'fhuizQXynm1YawHJLI9+GYfu/+8KnGMal+EalemtGRA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038