UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'pQeybZFTYDyhrk9N3qjjWO0ZCL6Jsxgd7jsipsw+Zmw=' 
WHERE 
  key_id = 'afccbef13fb2d2d6d67a291f861d9adc1196e7318c67f15d2e1fe92ae7f6918e' 
  AND (
    token = 'pQeybZFTYDyhrk9N3qjjWO0ZCL6Jsxgd7jsipsw+Zmw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035