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

Query time 0.00025