UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'wyKmjBlvnLOZd8W9vaopXQb5J7BidIYlp2RVs+UuvnQ=' 
WHERE 
  key_id = '187ebad61f4b8df36500d30699555481480b75b23c7368834198f324836fd067' 
  AND (
    token = 'wyKmjBlvnLOZd8W9vaopXQb5J7BidIYlp2RVs+UuvnQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033