UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'bsstaA61JgZjDvdCqLUuq1TFNzobH9KvHydCPt5LE+w=' 
WHERE 
  key_id = 'f215126b68ad48cf094d057cdfcefeedcb2e61813c7dbc39d2eb74476682399c' 
  AND (
    token = 'bsstaA61JgZjDvdCqLUuq1TFNzobH9KvHydCPt5LE+w=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00017