UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'i6yBBD9D05D06IoSoHsL82GGH/WnOoA+6mpnWZ3uD/s=' 
WHERE 
  key_id = 'd9670e3b24562b9bb5b7fc39382db0307ff4e5667a4a21db3e06a33235c72ecb' 
  AND (
    token = 'i6yBBD9D05D06IoSoHsL82GGH/WnOoA+6mpnWZ3uD/s=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00069