UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'SZf2co0lktnKBLpJG6OrWXMUwwa2Mbrb13v4SGcSdsE=' 
WHERE 
  key_id = '038ab0e85bfe82db529e2d4eaa94361abc45217309dd26083ff84871b3b56721' 
  AND (
    token = 'SZf2co0lktnKBLpJG6OrWXMUwwa2Mbrb13v4SGcSdsE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029