UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'gjbrrfAO4s+v8FT0wbykWTwUf3V6RV8C6RadL926tSQ=' 
WHERE 
  key_id = '7c7b76194c83ec036aadbaa24f62067a25d4f838ba1bd57cd10154901b841294' 
  AND (
    token = 'gjbrrfAO4s+v8FT0wbykWTwUf3V6RV8C6RadL926tSQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031