UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'zNiLzJpCXAmO9C+EL3Bg8J2CLCbcvrbdHXzkSyxAH5A=' 
WHERE 
  key_id = '248f772882c5d3e8194557dc1c3735eb99541bcd87845fc8fc43e17b2c99a256' 
  AND (
    token = 'zNiLzJpCXAmO9C+EL3Bg8J2CLCbcvrbdHXzkSyxAH5A=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030