UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'H0a1Th7Yl/I/YmeCBm+Kzrs8kcxIVcv0Gu0o2MHteFM=' 
WHERE 
  key_id = 'fa04b374e01954e35ca512ed7d7dd536dffd9400e7870da81d4d2e67d0757221' 
  AND (
    token = 'H0a1Th7Yl/I/YmeCBm+Kzrs8kcxIVcv0Gu0o2MHteFM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043