UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'x4dJ47JZb1S3j78YSdHHR/kk+nBMTXXUFTWyACQ8t1s=' 
WHERE 
  key_id = '6ca46d5a61942dd6bdf918861bcd8e0fc382c8506880be1369e008fdb595da7e' 
  AND (
    token = 'x4dJ47JZb1S3j78YSdHHR/kk+nBMTXXUFTWyACQ8t1s=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028