UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'pePN/RnhQ8jjUC6qoO4kEvCvIsDH1+qwH5EEQqHiqD4=' 
WHERE 
  key_id = '8b1350dfe0f623858f5ab8fdee0c8dd656611d111f12fb6d1a03c3cabedd4ff5' 
  AND (
    token = 'pePN/RnhQ8jjUC6qoO4kEvCvIsDH1+qwH5EEQqHiqD4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032