UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'HLOmikY2lk8R1EgihLhwhyFuFsgfhPFyAjrpNkTkwUA=' 
WHERE 
  key_id = '3e3815a9e7db907dd35190532f40bd761553287e36466372aa8e4889275eba83' 
  AND (
    token = 'HLOmikY2lk8R1EgihLhwhyFuFsgfhPFyAjrpNkTkwUA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00058