UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'aU3gC4XJyMXVPRQg5XHDVkD6fydAwZueXu6dEyRgbIw=' 
WHERE 
  key_id = '1b179111cb886751b438f7a6f9f9b4cbbcd20ee4c0746836c47b297d2405a717' 
  AND (
    token = 'aU3gC4XJyMXVPRQg5XHDVkD6fydAwZueXu6dEyRgbIw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00017