UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '30M+yMtL8twKQQC4evzpT4JDHjpa1imsPcukyf1Bhy8=' 
WHERE 
  key_id = 'aa4d536246e13d81d088886a8e7ea2094e392a6bb1c14c8443aeedb5af893883' 
  AND (
    token = '30M+yMtL8twKQQC4evzpT4JDHjpa1imsPcukyf1Bhy8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00049