UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'BBTUIJj55dJo9hk7LP1R438d+1PO2ULgemgHTfHXjoQ=' 
WHERE 
  key_id = '45aa42ae629ceb34ae155907dabbc21829cfc73630292810074d25b334a3d471' 
  AND (
    token = 'BBTUIJj55dJo9hk7LP1R438d+1PO2ULgemgHTfHXjoQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029