UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'AtqQ9hLja7H0XbG9zqXTvcCmn9efmgK5XCb1ZjRDtbQ=' 
WHERE 
  key_id = '0b21025b3b948ae1f715891db8bdd3f1cc851075ffb76f6a184c7db3ded14723' 
  AND (
    token = 'AtqQ9hLja7H0XbG9zqXTvcCmn9efmgK5XCb1ZjRDtbQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00050