UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'un96eT3vH1JwPES2G9o7/+czizZ+Fy60pAE/D9a+eHo=' 
WHERE 
  key_id = '5d942acf05a8d4b136b418342ffe37c303097a000550792e379e128957493709' 
  AND (
    token = 'un96eT3vH1JwPES2G9o7/+czizZ+Fy60pAE/D9a+eHo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00051