UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'lCfOHA5vA7XsPesuKYgZ+z6DMjLqPj6AGtqgIaaYFl8=' 
WHERE 
  key_id = '402f94788218d9f5db9bb974dc163fd0b51934431af43cbcbbdcfc21566dd592' 
  AND (
    token = 'lCfOHA5vA7XsPesuKYgZ+z6DMjLqPj6AGtqgIaaYFl8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044