UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'q7qiLZgMLHfKOV6qT+deve9n6QaDW8xY7Vaatshng/8=' 
WHERE 
  key_id = 'da3df6a36a1389f817131116c87ca1abdadc094453f711de281fa84bf28842bc' 
  AND (
    token = 'q7qiLZgMLHfKOV6qT+deve9n6QaDW8xY7Vaatshng/8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032