UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'quKSbXsvHgJebcn6iNpm8BNqIqxl3DFP+QVv+BbLhrM=' 
WHERE 
  key_id = '085d700c563883fbfe486f9e9dad8b1edc4f44ee0322b796a516f454c5d33316' 
  AND (
    token = 'quKSbXsvHgJebcn6iNpm8BNqIqxl3DFP+QVv+BbLhrM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037