UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'kVD6DJwCQfxLhdE/HQq/X1kHs0QAMpPiO1IQ9hnrSm0=' 
WHERE 
  key_id = '8ba8ad9befa51a6647ca358b371d0c27f6e43be7182e3ecdf1995d0ca1750d7d' 
  AND (
    token = 'kVD6DJwCQfxLhdE/HQq/X1kHs0QAMpPiO1IQ9hnrSm0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044