UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'p89Ine+voBsS/AcX1J9vYNBdWmgWS6bBDvynXqmRJOE=' 
WHERE 
  key_id = '82c9814b544d3db7fdf23a672863a72e164b3a498e55b204017829d3a7b2af51' 
  AND (
    token = 'p89Ine+voBsS/AcX1J9vYNBdWmgWS6bBDvynXqmRJOE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00020