UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'w2xTdUlWMorwe+9D0YM8U6hjWhs7BDHFE72Ag4M9Drg=' 
WHERE 
  key_id = 'bfbf8025e41ede7b3a395096094e75e15dd95020afa67fad6d4a085bd9c20779' 
  AND (
    token = 'w2xTdUlWMorwe+9D0YM8U6hjWhs7BDHFE72Ag4M9Drg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030