UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'J/gu9NMScokB7wIYPw6TgvHgTFB8r2xuWSaoEK74og4=' 
WHERE 
  key_id = '29c142fb064c571fbc1f7b7897ea2db94052127bca2fd7be3a6a73ad20149a63' 
  AND (
    token = 'J/gu9NMScokB7wIYPw6TgvHgTFB8r2xuWSaoEK74og4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031